<template>
  <div>
    <div class="app-basement F5F5F5Background">
      <div class="head-box content-basement">
        <div class="head-box-item-left">
          <span> 您好，欢迎来到{{qyname.split('/')[0]}}{{qyname.includes('/')?qyname.split('/')[1]:''}} </span>
        </div>
        <div>
          <i class="el-icon-phone"></i>
          <span> 服务热线:{{ phone }} </span>
        </div>
      </div>
    </div>
    <div class="app-basement">
      <div class="head-title content-basement">
        <div class="head-title-item">
          <img v-if="logo" :src="logo" alt="" />
          <!-- <img src="@/assets/logo.png" alt=""> -->
          <span>{{qyname.split('/')[0]}}{{qyname.includes('/')?qyname.split('/')[1]:''}}</span>
        </div>
        <div>
          <!-- $router.push("/apply") -->
          <el-button
            class="btn"
            @click="
              ()=>{
                this.$router.push({path:'/apply',query:{name:'特种设备'}})
              }
            "
            v-if="http.includes('bosheng')"
            >特种设备报名</el-button
          >
          <el-button
            class="btn"
            @click="
              $router.push('/apply?name='+'燃气从业人员培训')
            "
            v-if="http.includes('bosheng')"
            >燃气从业人员报名</el-button
          >
          <el-button
            class="btn"
            @click="
              handleSelect('10')
            "
            v-else
            >学习报名</el-button
          >
          <el-button class="btn2" @click="openLine">立即登录</el-button>
        </div>
      </div>
    </div>
    <div class="app-basement menu-background">
      <div class="content-basement">
        <el-menu :default-active="actives" mode="horizontal" @select="handleSelect" background-color="#0841FF" text-color="#eee" active-text-color="#fff">
          <el-menu-item index="1">网站首页</el-menu-item>
          <el-menu-item index="10">在线报名</el-menu-item>
          <el-menu-item index="4">培训学习</el-menu-item>
          <el-menu-item index="2">在线练习</el-menu-item>
          <el-menu-item index="3">模拟考试</el-menu-item>
          <el-menu-item index="5">政策法规</el-menu-item>
          <el-menu-item index="6">培训公告</el-menu-item>
          <el-menu-item v-if="this.http.indexOf('lcak') != -1" index="11">职业卫生公告</el-menu-item>
          <el-menu-item index="7">联系我们</el-menu-item>
          <!-- <el-menu-item index="8">考试计划</el-menu-item>
                    <el-menu-item index="9">证明打印</el-menu-item> -->
          
        </el-menu>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      qyname: "",
      actives: "1",
      phone: "",
      logo: "",
    };
  },
  computed: {
    ...mapGetters(["init", "http", "active"]),
  },
  watch: {
    active(val) {
      this.actives = val;
    },
  },
  created() {
    this.actives = this.active;
    this.qyname = this.init.alias;
    this.logo = this.init.logo;
    this.phone = JSON.parse(this.init.setting).userPhone; //手机号
  },
  methods: {
    handleSelect(key) {
      if((this.http.includes('dkaq')||this.http.includes('xcaq'))&&key==10){
        return this.$message.error('请到移动端报名!')
      }
      this.$store.commit("SET_ACTIVE", key);
    },
    openLine() {
      window.open(this.http + "/user", "_self");
    },
  },
};
</script>

<style lang="scss" scoped>
.head-box {
  height: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #aaa;
  .head-box-item-left {
    font-size: 14px;
  }
}
.head-title {
  height: 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .head-title-item {
    color: #333;
    font-weight:600;
    font-size: 28px;
    flex: 1;
    img {
      height: 50px;
      margin-right: 16px;
    }
  }
}
.menu-background {
  background: #0841FF;
}
::v-deep {
  .el-menu::after,
  .el-menu::before {
    display: none;
  }
  .el-menu-item{
    border: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding:0 30px !important;
    height: 100% !important;
    justify-content: center;
  }
  .is-active{
    border: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    position:relative;
    &::after{
      content:'';
      display: flex;
      height: 2px;
      width: 20px;
      background: #fff ;
      position: absolute;
      bottom: 10px;
    }
  }
  .el-menu--horizontal > .el-menu-item {
    height: auto;
    padding: 8px 0;
    line-height: 1;
  }
  .el-menu.el-menu--horizontal {
    border: none;
  }
  .el-menu--horizontal {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
</style>
